package edu.lhh;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import edu.lhh.dao.newstypedao;
import edu.lhh.dao.teachtypedao;
import edu.lhh.model.teachtype;
@WebServlet(urlPatterns="/enroll")
public class enroll extends HttpServlet {
private teachtypedao dao = new teachtypedao();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String str = new String(req.getParameter("ming").getBytes("ISO-8859-1"),"utf-8") ;
		teachtype tp = new teachtype();
		tp.setUser(req.getParameter("user"));
		tp.setPwd(req.getParameter("pwd"));
		tp.setMing(str);
		tp.setNum(req.getParameter("num"));
		dao.add(tp);
		if (tp != null){
			resp.sendRedirect("./success.jsp");
		}
		}
	

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
	}


}
	